<?php
/**
 * CreateTime: 2023/11/15 10:17
 * User:LinQ
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('case', function (Blueprint $table) {
            // 数据库基本配置
            $table->engine = 'InnoDB';
            $table->unique('case_no','idx_case_no');
            // 数据库字段
            $table->id('case_id')->comment("案件id");
            $table->integer('com_id')->nullable(false)->comment("用户所属公司id");
            $table->string('case_no')->nullable(false)->comment("案件编号");
            $table->string('name')->nullable(false)->comment("被申请人姓名");
            $table->string('id_card')->nullable(false)->comment("身份证号");
            $table->string('phone')->nullable(false)->comment("手机号");
            $table->string('tag')->nullable(false)->comment("标签");
            $table->integer('case_status')->nullable(false)->comment("案件状态");
            $table->integer('client_id')->nullable(false)->comment("委托方id");
            $table->integer('client_product_id')->nullable(false)->comment("委托方产品id");
            $table->string('case_batch_no')->nullable(false)->comment("案件批次号");
            $table->decimal('app_amount',15,3)->nullable(false)->comment("申请金额");
            $table->timestamp('overdue_date')->nullable(false)->comment("逾期日期");
            $table->integer('overdue_day_number')->nullable(false)->comment("逾期天数");
            $table->integer('created_staff_id')->nullable(false)->comment("创建人");
            $table->integer('follow_up_number')->nullable(false)->comment("被申请人跟进次数");
            $table->integer('status')->nullable(false)->comment("状态");

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
};
